﻿<%@ Page Title="" Language="VB" MasterPageFile="~/App/Master/App.master" AutoEventWireup="false" CodeFile="HashtagsMonitor.aspx.vb" Inherits="App_HashtagsMonitor" %>


<asp:Content ID="Content1" ContentPlaceHolderID="CphHead" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CphMainContent" runat="Server">
    <asp:ScriptManagerProxy runat="server">
        <Scripts>
            <asp:ScriptReference Path="https://www.google.com/jsapi" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <script type="text/javascript">

        google.load('visualization', '1.0', { 'packages': ['geochart'] });
        google.load("visualization", "1", { packages: ["corechart"] });


        $(function () {



            SetUI();
            on_update_panel_server(function () {
                SetUI();
            });

        });

        function SetUI() {

            $(".chosen-select").chosen();

            $("#TxtBeginDate").datepicker({
                dateFormat: 'yy-mm-dd',
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1,
                onClose: function (selectedDate) {
                    $("#TxtEndDate").datepicker("option", "minDate", selectedDate);
                }
            });
            $("#TxtEndDate").datepicker({
                dateFormat: 'yy-mm-dd',
                defaultDate: "+1w",
                changeMonth: true,
                numberOfMonths: 1,
                onClose: function (selectedDate) {
                    $("#TxtBeginDate").datepicker("option", "maxDate", selectedDate);
                }
            });


        }

        function DrawChartPostSend(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "80%", height: "80%" },
                focusTarget: 'category',
                lineWidth: 3, pointSize: 7, curveType: '',
                hAxis: { slantedText: false, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { targetAxisIndex: 0, color: '#29ABE2' },
                    { targetAxisIndex: 1, color: '#67B203' }
                ],
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }
            };

            var chart = new google.visualization.LineChart(document.getElementById('chart_div_post_send'));
            chart.draw(data, options);

        }

        function DrawChartPostSend2(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var formatter = new google.visualization.NumberFormat({ suffix: '%', fractionDigits: 0 });
            formatter.format(data, 2);


            var options = {
                chartArea: { left: '8%', top: '5%', width: "90%", height: "80%" },
                focusTarget: 'category',
                isStacked: false,
                hAxis: { slantedText: false, minTextSpacing: 0, maxAlternation: 1, maxTextLines: 1 },
                vAxes: [{ textPosition: 'out' }, { textPosition: 'out' }],
                series: [
                    { targetAxisIndex: 0, color: '#ff6a00', type: 'bars' },
                    { targetAxisIndex: 1, color: '#7CCBED', type: 'bars' }
                ],
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }
            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_div_post_send2'));
            chart.draw(data, options);

        }

        function DrawChartAutoFollow(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "90%", height: "80%" },
                focusTarget: 'category',
                isStacked: true,
                hAxis: { slantedText: false, minTextSpacing: 0, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { color: '#C1272D', type: 'line', lineWidth: 3, pointSize: 7, curveType: '' },
                    { color: '#67B203', type: 'bars' },
                    { color: '#FFD203', type: 'bars' }
                ], bar: { groupWidth: '80%' },
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }

            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_auto_foll_div'));
            chart.draw(data, options);
        }

        function DrawChartAutoFollow2(o) {
            var data = google.visualization.arrayToDataTable(o.data);

            var options = {
                chartArea: { left: '8%', top: '5%', width: "90%", height: "80%" },
                focusTarget: 'category',
                isStacked: true,
                hAxis: { slantedText: false, minTextSpacing: 0, maxAlternation: 1, maxTextLines: 1 },
                series: [
                    { color: '#C1272D', type: 'line', lineWidth: 3, pointSize: 7, curveType: '' },
                    { color: '#67B203', type: 'bars' },
                    { color: '#FFD203', type: 'bars' }
                ], bar: { groupWidth: '80%' },
                legend: { maxLines: 1, position: 'bottom', alignment: 'start' }

            };

            var chart = new google.visualization.ComboChart(document.getElementById('chart_auto_foll_div2'));
            chart.draw(data, options);
        }

    </script>

    <!-- box 1 -->
    <div class="row-fluid">
        <!-- console -->
        <asp:UpdatePanel ID="UpPConsole" runat="server" UpdateMode="Conditional" class="manage">
            <ContentTemplate>
                <div class="well-manage">
                    <!-- filtri -->
                    <div class="well-manage-sx">
                        <div class="top-bar">
                            follow monitor			                
                        </div>

                        <div class="manage-sx-bottom">
                            <div class="manage-message-head">

                                <asp:TextBox runat="server" ID="TxtBeginDate" CssClass="" Visible="false"></asp:TextBox>
                                <asp:TextBox runat="server" ID="TxtEndDate" CssClass="" Visible="false"></asp:TextBox>


                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDayAll" Text="always" CommandName="CONSOLE_DAY" CommandArgument="all" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay15" Text="15" CommandName="CONSOLE_DAY" CommandArgument="15" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay30" Text="30" CommandName="CONSOLE_DAY" CommandArgument="30" />
                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay60" Text="60" CommandName="CONSOLE_DAY" CommandArgument="60" />

                                </div>
                                <div>
                                    <asp:LinkButton runat="server" CssClass="pg-count" ID="RbtDay90" Text="90" CommandName="CONSOLE_DAY" CommandArgument="90" />


                                </div>
                                <div><a href="#" class="a-icona5"></a></div>
                            </div>
                            <div class="manage-input">
                                <label>user name</label>
                                <asp:TextBox runat="server" ID="TxtUsername" placeholder="@username" CssClass=""></asp:TextBox>
                                <label>full name</label>
                                <asp:TextBox runat="server" ID="TxtFullname" placeholder=" " CssClass=""></asp:TextBox>

                                <asp:Panel runat="server" ID="PnlSearchHashtag">
                                    hashtag:
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlHashtag" SelectionMode="Multiple" />
                                    <%--                                    Link:
                                    <asp:ListBox multiple="" runat="server" CssClass="chosen-select" Width="200px" ID="DdlLinkType2" SelectionMode="Multiple" />--%>
                                </asp:Panel>

                            </div>
                            <div class="option-search">
                                <asp:LinkButton runat="server" ID="BtnExport" CssClass="bottone-save" Text="search" />
                            </div>
                        </div>
                    </div>

                    <!-- gestione filtri -->
       <%--             <div class="well-manage-dx">
                        <div class="top-bar">
                            filter
                        </div>
                        <div class="manage-dx-left">

                            <asp:TextBox runat="server" ID="TxtNewFilter" CssClass="" placeholder="name your new filter"></asp:TextBox>
                            <div class="option-save">
                                <asp:LinkButton runat="server" CssClass="bottone-save" ID="BtnAddFilter" Text="Add" />
                            </div>
                            <div>
                                <asp:DropDownList runat="server" ID="DdlAccountFilter" AutoPostBack="true" />
                                <asp:LinkButton runat="server" CssClass="bottone-save" ID="BtnSaveFilter" Text="Save" />
                                <asp:LinkButton runat="server" CssClass="a-icona-chiudi" ID="BtnRemoveFilter" />
                            </div>
                        </div>
                        <div class="top-bar">
                            list
                        </div>

                        <div class="manage-dx-left">

                                <asp:DropDownList runat="server" ID="DdlOnLineList" AutoPostBack="false" />
                            <asp:TextBox runat="server" ID="TxtNewList" CssClass="" placeholder="name your new list"></asp:TextBox>
                            <div class="option-save">
                                <asp:LinkButton runat="server" CssClass="bottone-save" ID="BtnAddList" Text="Add" />
                            </div>

                        </div>
                        <!-- fine contenuto -->
                    </div>--%>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

    <!-- box 2 -->
    <div class="row-fluid">

        <!-- account listen -->
        <asp:UpdatePanel ID="UpPAccountListen" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel runat="server" ID="PnlAccountListen" CssClass="found">

                    <!-- grafico -->
                    <div class="con-grafico">
                        <div id="chart_div_post_send" style="height: 250px; width: 100%; overflow: hidden;">
                        </div>
                    </div>

                    <!-- account trovati -->
                    <div class="top-bar">
                        <div class="top-found">
                            found: 
                            <asp:Label runat="server" ID="LblAccountListenCount" CssClass="found-count" />
                        </div>
                        <div class="option-xml-export">
                            <a class="bottone-export" href="#">xls export</a>
                        </div>
                    </div>

                    <!-- lista account -->
                    <div class="well-found">

                        <div class="hash-head">
                            <div class="found-hash-user"><a href="#" class="found-head-title">user</a></div>
                            <div class="found-hash-tweets"><a href="#" class="found-head-title">tweets</a></div>
                            <div class="found-hash-follower"><a href="#" class="found-head-title-a">followers</a></div>
                            <div class="found-hash-user-b"><a href="#" class="found-head-title">user</a></div>
                            <div class="found-hash-tweets-b"><a href="#" class="found-head-title">tweets</a></div>
                            <div class="found-hash-follower-b"><a href="#" class="found-head-title-a">followers</a></div>
                            <div class="found-hash-user"><a href="#" class="found-head-title">user</a></div>
                            <div class="found-hash-tweets"><a href="#" class="found-head-title">tweet</a></div>
                            <div class="found-hash-follower"><a href="#" class="found-head-title-a">followres</a></div>
                        </div>

                        <asp:ListView runat="server" ID="ListAccountListen">
                            <ItemTemplate>
                                <div class="found-hash">
                                    <ul>
                                        <div class="found-hash-user"><%# Container.DataItem(0)("account_username")%> </div>
                                        <div class="found-hash-tweets"><%# UI.Print.Num0(Container.DataItem(0)("Post_count"))%></div>
                                        <div class="found-hash-follower"><%# UI.Print.Num0(Container.DataItem(0)("account_follower_count"))%></div>
                                        <div class="found-hash-user-b"><%# Container.DataItem(1)("account_username")%> </div>
                                        <div class="found-hash-tweets-b"><%# UI.Print.Num0(Container.DataItem(1)("Post_count"))%></div>
                                        <div class="found-hash-follower-b"><%# UI.Print.Num0(Container.DataItem(1)("account_follower_count"))%></div>
                                        <div class="found-hash-user"><%# Container.DataItem(2)("account_username")%>&nbsp;</div>
                                        <div class="found-hash-tweets"><%# UI.Print.Num0(Container.DataItem(2)("Post_count"))%></div>
                                        <div class="found-hash-follower"><%# UI.Print.Num0(Container.DataItem(2)("account_follower_count"))%></div>
                                    </ul>
                                </div>
                            </ItemTemplate>
                        </asp:ListView>
                        <App:DataPager runat="server" Controlid="ListAccountListen" PageSize="20" OnPageChanged="SetDataAccountList" />

                    </div>


                    <%--                    <asp:GridView ID="GridAccount" Font-Size="12px" runat="server" CssClass="summary-results" ShowHeader="true" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="True">
                        <Columns>
                            <asp:TemplateField HeaderText="Nome" ItemStyle-CssClass="" SortExpression="fullname">
                                <ItemTemplate>
                                    <asp:HyperLink runat="server" NavigateUrl='<%# "https://twitter.com/" & Eval("account_username")%>' Target="_blank">
                                            @<asp:Label runat="server" Text='<%# Eval("account_username")%>'></asp:Label>
                                    </asp:HyperLink>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="post" SortExpression="">
                                <ItemTemplate>
                                    <asp:Label runat="server" Text='<%# eval("post_count") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="follower" SortExpression="">
                                <ItemTemplate>
                                    <asp:Label runat="server" Text='<%# eval("account_follower_count") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <AlternatingRowStyle CssClass="AlternatingRow Padding2" />
                        <HeaderStyle CssClass="Header" />
                        <RowStyle CssClass="Row Padding2" />
                        <PagerTemplate>
                            <App:GridPager ID="GridPager1" runat="server" />
                        </PagerTemplate>
                    </asp:GridView>--%>
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>



    </div>




 
</asp:Content>
